home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / Premiere 4.2 SDK r3 Mac / Examples / Projects / SuperMac / SuperMac.c < prev    next >
Text File  |  1996-01-25  |  4KB  |  122 lines

  1. //========================================================================================
  2. //
  3. // SuperMac.c - Zoom module for SuperMac video cards.
  4. //
  5. // Written by Randy Ubillos and Bryan K. "Beaker" Ressler.
  6. //
  7. // Copyright ⌐ 1993-96, Adobe Systems Incorporated, all rights reserved worldwide.
  8. //
  9. // Version    1.00    10/20/93    Original version.
  10. // Version    1.01    9/12/94        Updated for 4.0.
  11. // Version  1.02    10/26/95    Updated for 4.2 and CW7.
  12. //
  13. //========================================================================================
  14.  
  15. //========================================================================================
  16. // Includes - use precompiled headers if compiling with CodeWarrior.
  17. //========================================================================================
  18. #ifdef __MWERKS__
  19.     #ifdef powerc
  20.         #include "PremierePPC"
  21.     #else
  22.         #include "Premiere68k"
  23.     #endif
  24. #else
  25.     #include "Premiere.h"
  26. #endif
  27.  
  28. //========================================================================================
  29. // Structure for the Status and Control calls
  30. //========================================================================================
  31. typedef struct {
  32.     QElem        *qLink;            // Queue link in header
  33.     short        qType;            // Type byte for safety check
  34.     short        ioTrap;            // FS: the Trap
  35.     Ptr            ioCmdAddr;        // FS: address to dispatch to
  36.     ProcPtr        ioCompletion;    // Completion routine addr (0 for synch calls)
  37.     OSErr        ioResult;        // Result code
  38.     StringPtr    ioNamePtr;        // Ptr to Vol:FileName string
  39.     short        ioVRefNum;        // Volume refnum (DrvNum for Eject and MountVol)
  40.     short        ioCRefNum;        // RefNum for I/O operation
  41.     short        csCode;            // Word for control status code
  42.     Ptr            csParam;        // Operation-defined parameters
  43.     long        dummy[5];        // Extra
  44. } boardParam;
  45.  
  46. //========================================================================================
  47. // Codes that the SuperMac driver knows about
  48. //========================================================================================
  49. #define csZoomIn            0x0400
  50. #define csZoomOut            0x0401
  51. #define csVisibleRect        0x0403
  52. #define csGetTopLeft        0x0404
  53. #define csSetPanFlag        0x0405
  54. #define csSetPanLoc            0x0406
  55.  
  56. //========================================================================================
  57. // Process the commands
  58. //========================================================================================
  59. pascal short main (short selector, ZoomHand theData)
  60. {
  61.     short        result = 0;
  62.     boardParam    block;
  63.     GDHandle    theGD;
  64.     Point        spot;
  65.     short        zero = 0, one = 1;
  66.     
  67.     // Cache up the GDevice in question
  68.     theGD = (*theData)->theDevice;
  69.     
  70.     // Act according to the selector
  71.     switch (selector) {
  72.         case cmdCanDo:
  73.         case cmdCanZoom:
  74.             // Premiere is asking the ZooM module whether the card driving the specifed
  75.             // GDevice can perform hardware zoom. Result = false means the device CAN'T
  76.             // zoom, result = true means it CAN.
  77.             block.ioCRefNum = (*theGD)->gdRefNum;
  78.             block.csCode = csGetTopLeft;
  79.             if (!PBStatus((ParmBlkPtr)&block, false))
  80.                 result = true;
  81.             break;
  82.         case cmdZoomIn:
  83.             // Premiere is telling the ZooM module to zoom in (make pixels bigger). So,
  84.             // we call the driver to zoom it in turn off panning, and set the pan loc-
  85.             // ation to 0, 0.
  86.             block.ioCRefNum = (*theGD)->gdRefNum;
  87.  
  88.             block.csCode = csZoomIn;
  89.             PBControl((ParmBlkPtr)&block, false);            // Zoom in
  90.     
  91.             block.csCode = csSetPanFlag;                    // Disable panning
  92.             block.csParam = (Ptr)&zero;
  93.             PBControl((ParmBlkPtr)&block, false);
  94.     
  95.             spot.h = 0;
  96.             spot.v = 0;
  97.             block.csCode = csSetPanLoc;
  98.             block.csParam = (Ptr)&spot;
  99.             PBControl((ParmBlkPtr)&block, false);            // Move h/w to 0, 0
  100.             break;
  101.         case cmdZoomOut:
  102.             // Playback is complete, and Premiere is telling the ZooM module to zoom out
  103.             // (make pixels normal size again). So, we call the driver to re-enable pan-
  104.             // ning and zoom back out.
  105.             block.ioCRefNum = (*theGD)->gdRefNum;
  106.  
  107.             block.csCode = csSetPanFlag;                    // Enable panning
  108.             block.csParam = (Ptr)&one;
  109.             PBControl((ParmBlkPtr)&block, false);
  110.     
  111.             block.csCode = csZoomOut;                        // Zoom out
  112.             PBControl((ParmBlkPtr)&block, false);
  113.             break;
  114.         case cmdGetSupportedModes:
  115.         case cmdGetMode:
  116.         case cmdSetMode:
  117.         default:
  118.             break;
  119.     }
  120.     return(result);
  121. }
  122.